/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package Mail;

/**
 *
 * @author fabio
 */
public class ServidorMessage {
    private Message message;
    private MailServer server;

    public ServidorMessage(Message message) {
        this.message = message;
    }

    public ServidorMessage(MailServer server) {
        this.server = server;
    }

    public ServidorMessage(Message message, MailServer server) {
        this.message = message;
        this.server = server;
    }

    @Override
    public String toString() {
        return "ServidorMessage{" + "message=" + message + ", server=" + server + '}';
    }

    public Message getNextMessage(String user) {
      Message msj= server.getNextMessage(user);
      return msj;
    }

    public void post(Message mensaje) {
        server.post(mensaje);
    }
    
    public Message[] mensajes(){
        return server.obtenerLista();
    }
    
}
